<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

/** ============================== || 首页路由 || ===================================== **/
Route::get('/','home\IndexController@index')->middleware('checkweixin','count');

/** ============================== || 即时通信路由 ||================================= **/
Route::group(['prefix' => '/chat','middleware' => 'checkChat'],function () {
    Route::get('send/{id}', 'chat\ChatController@index');
    Route::post('send/echo', 'chat\ChatController@send');
    Route::post('receive', 'chat\ChatController@recive');
});


/** ============================== || 药剂师工作台 ||================================= **/
Route::get('/home/doctor/login','chat\DoctorController@login');
//药师控制台
Route::group(['prefix' => '/doctor','middleware' => 'checkDoctor'],function () {
    Route::get('asklist', 'chat\DoctorController@asklist');
    Route::post('askinfo', 'chat\DoctorController@askinfo');
    Route::post('csta', 'chat\DoctorController@csta');
    Route::post('selt', 'chat\DoctorController@selt');
    Route::get('docinfo', 'chat\DoctorController@docinfo');
    Route::post('upinfo', 'chat\DoctorController@upinfo');
    Route::post('redata', 'chat\DoctorController@redata');
    Route::post('chstu', 'chat\DoctorController@chstu');
    Route::get('credinfo', 'chat\DoctorController@credinfo');
    Route::post('upcred', 'chat\DoctorController@upcred');

});



/** ============================== || 配送员工作台 ||================================= **/
Route::get('/sender/login', 'sender\SenderController@login'); //配送员登录
Route::post('/sender/dologin', 'sender\SenderController@dologin');
Route::group(['prefix' => '/sender','middleware' => 'checkSender'],function () {
    Route::get('index', 'sender\SenderController@index');
    Route::post('redata', 'sender\SenderController@redata');
    Route::post('chstu', 'sender\SenderController@chstu');
    Route::get('info', 'sender\SenderController@info');
    Route::get('orderinfo', 'sender\SenderController@checkOrder');
    Route::get('sendinfo', 'sender\SenderController@sendinfo');
    Route::post('upinfo', 'sender\SenderController@upinfo');

});

/** ============================== || 定位路由 ||================================= **/
Route::post('/location','home\DistanceController@slstore');

/** ============================== || 验证码路由 ||================================= **/
Route::post('/sendcode','home\PcodeController@sendCode');

/** ============================== || 退出路由 ||================================= **/
Route::group(['prefix' => '/logout'],function () {
    Route::get('home', 'LoginoutController@homeLoginout');
    Route::get('admin', 'LoginoutController@adminLoginout');
    Route::get('store', 'LoginoutController@storeLoginout');
});


/** ============================ || 后台路由群组 ||================================ **/
Route::group(['prefix' => '/admin','middleware' => 'checkadmin'],function(){
    //后台主页
    Route::get('/','admin\AdminController@index');
    Route::get('/main','admin\main\MainController@index');

    //请求统计数据
    Route::post('/redata','admin\main\MainController@redata');

    //网站配置
    Route::resource('/setting','admin\setting\SettingController');
    //后台商品类型板块
    Route::get('/type','admin\TypeController@index');
    Route::get('/type/add','admin\TypeController@doadd');
    Route::post('/type/add','admin\TypeController@add');
    Route::post('/type/edit','admin\TypeController@edit');
    Route::post('/type/query','admin\TypeController@query');
    Route::post('/type/del','admin\TypeController@del');
    Route::post('/type/file','admin\TypeController@file');

    //商家管理
    Route::resource('/store','admin\shop\StoreController');
    Route::post('/store/district','admin\shop\StoreController@district');
    Route::post('/store/editLogo','admin\shop\StoreController@editLogo');
    Route::post('/store/detail','admin\shop\StoreController@detail');
    Route::post('/store/status','admin\shop\StoreController@status');

    //药师管理
    Route::resource('/doctor','admin\doctor\DoctorController');
    Route::post('/doctor/editphoto','admin\doctor\DoctorController@editphoto');
    Route::post('/doctor/credInfo','admin\doctor\DoctorController@credInfo');
    Route::post('/doctor/userInfo','admin\doctor\DoctorController@userInfo');
    Route::post('/doctor/status','admin\doctor\DoctorController@status');


    //快递员管理
    Route::resource('/sender','admin\sender\SenderController');
    Route::post('/sender/editphoto','admin\doctor\DoctorController@editphoto');
    Route::post('/sender/userInfo','admin\sender\SenderController@userInfo');
    Route::post('/sender/status','admin\sender\SenderController@status');

    //评论回复
    Route::resource('/comment','admin\comment\commentController');
    Route::post('/comment/content','admin\comment\commentController@content');
    Route::post('/comment/recontent','admin\comment\commentController@recontent');
    Route::post('/comment/replay','admin\comment\commentController@replay');
    Route::post('/comment/comStatus','admin\comment\commentController@comStatus');
    Route::post('/comment/repStatus','admin\comment\commentController@repStatus');


    //后台用户管理
    Route::get('/user/adminlist','admin\user\AdminController@index');
    Route::get('/user/doctorlist','admin\user\DoctorController@index');

    //用户状态
    Route::get('/user/userlist/status/{id}/{sta}','admin\user\UserController@status');
    //普通用户管理
    Route::resource('/user/userlist', 'admin\user\UserController');

    //订单管理
    Route::get('/user/orderlist','admin\user\OrderController@index');
    Route::get('/user/recycleorder','admin\user\OrderController@recycleorder');

    //主题管理
    Route::resource('/theme/banner','admin\theme\BannerController');
    Route::post('/theme/banner/getrow','admin\theme\BannerController@getRow');
    Route::post('/theme/banner/del','admin\theme\BannerController@del');
    Route::post('/theme/banner/update','admin\theme\BannerController@update');
    Route::post('/theme/banner/file','admin\theme\BannerController@file');
    Route::resource('/theme/rexiao','admin\theme\RexiaoController');
    Route::post('/theme/rexiao/getrow','admin\theme\RexiaoController@getRow');
    Route::post('/theme/rexiao/del','admin\theme\RexiaoController@del');
    Route::post('/theme/rexiao/update','admin\theme\RexiaoController@update');
    Route::post('/theme/rexiao/file','admin\theme\RexiaoController@file');
    //超级管理员的增删改
    Route::resource('/super','admin\SuperController');
    Route::post('/super/editLogo','admin\SuperController@editLogo');
    Route::post('/super/delete','admin\SuperController@delete');
    Route::post('/super/setstatus','admin\SuperController@setstatus');
    //管理员个人中心
    Route::get('/adminself','admin\admin\AdminController@index');
    Route::post('/adminself/xiugai','admin\admin\AdminController@xiugai');


});

/** ============================ || 商家管理后台 ||================================ **/
Route::group(['prefix' => '/store','middleware' => 'checkStore'],function(){
    //后台主页
    Route::get('/','admin\AdminController@indexStore');
    Route::get('/storeMain','admin\main\StoreMainController@index');

    //请求统计数据
    Route::post('/redata','admin\main\StoreMainController@redata');

    //后台商品后台分类
    Route::get('/category','admin\CategoryController@index');
    Route::get('/category/add','admin\CategoryController@doadd');
    Route::post('/category/add','admin\CategoryController@add');
    Route::post('/category/edit','admin\CategoryController@edit');
    Route::post('/category/query','admin\CategoryController@query');
    Route::post('/category/del','admin\CategoryController@del');



    //商品管理
    Route::resource('/product','admin\product\ProductController');
    Route::post('/product/type','admin\product\ProductController@type');
    Route::post('/product/categroy','admin\product\ProductController@categroy');
    Route::post('/product/img','admin\product\ProductController@proImage');
    Route::post('/product/delimg','admin\product\ProductController@delImg');
    Route::post('/product/addimg','admin\product\ProductController@addImg');
    Route::post('/product/preimg','admin\product\ProductController@preImg');
    Route::post('/product/status','admin\product\ProductController@status');
    Route::post('/product/hod','admin\product\ProductController@hod');
    Route::post('/product/detail','admin\product\ProductController@detail');

    //评论回复
    Route::resource('/comment','admin\comment\StoreCommentController');
    Route::post('/comment/content','admin\comment\StoreCommentController@content');
    Route::post('/comment/recontent','admin\comment\StoreCommentController@recontent');
    Route::post('/comment/replay','admin\comment\StoreCommentController@replay');

    //商家个人中心
    Route::get('/storeself','admin\store\StoreController@index');
    Route::post('/storeself/update','admin\store\StoreController@update');

    //订单管理
    Route::get('/orderlist','admin\product\OrderController@index');
    Route::post('/allocation','admin\product\OrderController@allocation');
});

//后台Ajax的验证都在里面
Route::group(['prefix' => '/admin/user/ajax'],function(){
    //用户状态
    Route::post('/status','admin\user\AjaxController@status');
    //用户的地址
    Route::post('/seladdress','admin\user\AjaxController@seladdress');
    Route::post('/regsuc','admin\user\AjaxController@regsuc');
    //订单详情
    Route::post('/selorder','admin\user\AjaxController@selorder');
    Route::post('/deleteorder','admin\user\AjaxController@deleteorder');
    Route::post('/editorder','admin\user\AjaxController@editorder');

});


//前台的登陆验证
Route::get('/home/user/login','home\user\UserController@login');
Route::get('/home/user/register/{id?}','home\user\UserController@register');

/** 微信登录 */
Route::get('/home/user/wxlogin/{id?}','home\user\UserController@wxlogin');

/** 微信支付路由 */
Route::group(['prefix'=>'/pay'],function () {
    Route::post('wxpay', 'home\PayController@wxpay');
    Route::post('wx_notify', 'home\PayController@wxNotify');

});
//前台路由群组
Route::group(['prefix'=>'/home'],function ()
{
    //前台商品总列表
    Route::get('/typelist','home\product\ProductController@typelist');
    //商品列表
    Route::get('/type/{tmp}','home\product\ProductController@type');
    //商品详情页
//    Route::get('/product/detail','home\IndexController');
    //疗程购
    Route::get('/liaochenggou','home\IndexController@liaochenggou');
    //前台商品搜索
    Route::post('/search','home\product\ProductController@seacrhpro');

});

//前台商品路由
/** 拉取商品数据 */
Route::post('reproduct','product\productController@redata');
Route::post('selpro','product\productController@selpro');
Route::get('productlist','product\productController@list');

Route::group(['prefix'=>'/product'],function(){
    Route::get('/{id?}','product\ProductController@index');

});
//购物车的路由群组
Route::post('/home/ajax/cart','home\user\AjaxController@selcart');
Route::group(['prefix'=>'/home/ajax/cart','middleware' => 'checkUser'],function(){
    Route::post('/doadd','home\user\AjaxController@doadd');
    Route::post('/dominus','home\user\AjaxController@dominus');
    Route::post('/delqing','home\user\AjaxController@delqing');
	Route::post('/incart','home\user\AjaxController@incart');
	Route::post('/num','home\user\AjaxController@num');
	Route::post('/cartStatus','home\user\AjaxController@cartStatus');
	Route::post('/delProduct','home\user\AjaxController@delProduct');
});


//个人中心首页
Route::get('/home/user','home\user\UserController@index');
/** 药师咨询路由 */
Route::get('/chat/doctor', 'chat\DoctorController@index')->middleware('checkUser');
//个人中心路由群组
Route::group(['prefix' => '/home/user','middleware' => 'checkUser'],function(){
    //前台个人中心

    Route::get('code', 'chat\CodeController@code');/** 二维码生成器 */
    Route::get('coupon', 'home\user\CouponController@redatas');
    Route::get('/dizhi','home\user\UserController@dizhi');
    Route::get('/adddizhi','home\user\UserController@adddizhi');
    Route::get('/updadizhi/{id}','home\user\UserController@updadizhi');
    Route::get('/deldizhi/{id}','home\user\UserController@deldizhi');
    //用户个人信息
    Route::get('/userinfo','home\user\UserController@userinfo');
    Route::post('/userupdate/{id}','home\user\UserController@userupdate');
    Route::get('/pwd','home\user\UserController@pwd');
    //提交订单页
    Route::get('/order/suborder/{id?}','home\user\OrderController@suborder');
    Route::get('/order/updatedizhi/{id}','home\user\OrderController@updatedizhi');
    Route::get('/order/order/{id}','home\user\OrderController@order');
    Route::get('/order/orderlist/{id}','home\user\OrderController@orderlist');
    Route::post('/order/insorder/{id?}','home\user\OrderController@insorder');
    Route::get('/order/payorder','home\user\OrderController@payorder');
    Route::get('/order/cancelorder/{id}','home\user\OrderController@cancelorder');
    Route::get('/order/deleteorder/{id}','home\user\OrderController@deleteorder');
    Route::get('/order/evaluate/{id}','home\user\OrderController@evaluate');
    Route::post('/order/evaluateorder','home\user\OrderController@evaluateorder');
});

//登录注册的Ajax的验证都在里面
Route::post('/home/user/ajax/login','home\user\AjaxController@ylogin');
Route::post('/home/user/ajax/doclogin','home\user\AjaxController@doclogin');
Route::post('/home/user/ajax/resgName','home\user\AjaxController@resgName');
Route::post('/home/user/ajax/regsuc','home\user\AjaxController@regsuc');

//前台Ajax的验证都在里面
Route::group(['prefix' => '/home/user/ajax','middleware' => 'checkUser'],function(){
    Route::post('/pwd','home\user\AjaxController@pwd');
    Route::post('/dizhi/city','home\user\AjaxController@docity');
    Route::post('/dizhi/xian','home\user\AjaxController@doxian');
    Route::post('/adddizhi','home\user\AjaxController@adddizhi');
    Route::post('/changedizhi','home\user\AjaxController@changedizhi');
    Route::post('/defdizhi','home\user\AjaxController@defdizhi');
});



//后台登录页面 无家可归
Route::get('/admin/adminlogin','admin\AdminController@adminlogin');
Route::post('/admin/chkadminuname','admin\AdminController@chkadminuname');
Route::post('/admin/chkadminlogin','admin\AdminController@chkadminlogin');
Route::get('/admin/storelogin','admin\AdminController@storelogin');
Route::post('/admin/chkstoreuname','admin\AdminController@chkstoreuname');
Route::post('/admin/chkstorelogin','admin\AdminController@chkstorelogin');


/** ============================== 测试路由 ================================= **/
Route::get('/test', 'home\user\OrderController@wx_js');
Route::get('/test1','TestController@test');
//Route::get('/test','DataController@income');



